package com.ymatou.iapi.livebuyer.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.livebuyer.parameter.QueryDirtyWordsBean;
import com.ymatou.iapi.livebuyer.service.QueryDirtyWordsCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.LiveRoomCallService;
import com.ymttest.utils.TestDataManager;
/**
*查询脏字列表
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_QueryDirtyWords{
	private static QueryDirtyWordsBean querydirtywordsBean;
	private static QueryDirtyWordsCall querydirtywordsCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询脏字列表");
	}

	@Before
	public void caseUp() {
		querydirtywordsBean=new QueryDirtyWordsBean();
		querydirtywordsCall=new QueryDirtyWordsCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(querydirtywordsCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_QueryDirtyWords_001() {
		Logger.start(true,"查询脏字列表成功");
		try {
			String words="脏字"+TestDataManager.getRandomNum(1);
			LiveRoomCallService.AddDirtyWords(words);
			querydirtywordsBean.setAppId("autoTest");
			querydirtywordsBean.setPageIndex(1);
			querydirtywordsBean.setPageSize(50);
			querydirtywordsCall.setData(querydirtywordsBean);
			querydirtywordsCall.callService();			
			Logger.verifyEquals("200", querydirtywordsCall.getString("code"), "验证code");
			Logger.verifyEquals(true,querydirtywordsCall.getString("data").contains(words),"验证data");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}